/**
 * =====================================================================================
 *       @file  ngx_shmtx.h
 *      @brief  
 *
 *  Detailed description starts here.
 *
 *   @internal
 *     Created  2012年05月11日 10时43分43秒 
 *    Revision  1.0.0.0
 *    Compiler  gcc/g++
 *
 *     @author  luis
 * =====================================================================================
 */

#ifndef _H_NGX_SHMTX_H_INCLUDED_
#define _H_NGX_SHMTX_H_INCLUDED_

#include "ngx_config.h"
#include "ngx_core.h"
#include "ngx_shmem.h"
#include "ngx_atomic.h"

typedef struct
{
    ngx_atomic_t        lock;
} ngx_shmtx_sh_t;

typedef struct {
    ngx_atomic_t        *lock;
    ngx_uint_t           spin;
} ngx_shmtx_t;

ngx_int_t ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr);
void ngx_shmtx_destroy(ngx_shmtx_t *mtx);
ngx_int_t ngx_shmtx_trylock(ngx_shmtx_t *mtx);
void ngx_shmtx_unlock(ngx_shmtx_t *mtx);



#endif

